import { ApiProperty, PartialType } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsOptional, IsNotEmpty } from 'class-validator';

export class UserDto {
  @ApiProperty({ description: 'id' })
  @IsOptional()
  id?: string;

  @ApiProperty({ description: '登录账号', example: 'admin' })
  userName: string;

  @ApiProperty({ description: '登录密码', example: 'herin123' })
  passWord: string;

  @ApiProperty({ description: '真实姓名', example: '张三' })
  realName: string;

  @ApiProperty({ description: '部门id', example: '001' })
  depatID: string;

  @ApiProperty({ description: '角色id数组', example: [0, 1, 2] })
  @IsNotEmpty()
  roleIds: string[];
}

export class UserUpdateDto extends PartialType(UserDto) {}
